<!--
 * @Description: 
 * @Autor: 孙婧雯
 * @Date: 2021-07-04 13:46:01
 * @LastEditors: 孙婧雯
 * @LastEditTime: 2021-07-04 14:02:37
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #div1 {
      width: 100px;
      height: 100px;
      background: red;
    }
  </style>
</head>

<body>
  <div id="div1"></div>
  mima: <input id="inpt1" value="" type="text">
  <script>
    var oInpt1 = document.getElementById('inpt1');
    // onfocus onblur
    oInpt1.onblur = function () {
      console.log(this.value);
    }

    var oDiv1 = document.getElementById('div1');
    oDiv1.onmouseover = function () {
      oDiv1.style.background = 'blue'
    }
    oDiv1.onmouseout = function () {
      oDiv1.style.background = 'red'
    }






  </script>
</body>

</html>